# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-ip2location
pkgname=('python2-ip2location' 'python-ip2location')
_pkgname=IP2Location
pkgver=8.10.5
pkgrel=1
pkgdesc='Python API for IP2Location database.'
arch=('any')
url='https://pypi.org/project/IP2Location/#files'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/IP2Location-$pkgver.tar.gz")
sha512sums=('990dac68b863cd4043230915d63b43df133b71a28a06c4dd41c023a08e5b63b614423063a93616696e3065c6b5dfabe9457cf5eec4f8dce85bbfae2c98bb21a7')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-ip2location() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build
}

package_python-ip2location() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build
}

